﻿Public Class ucThuTien
    'biến lưu tên user control nhấn vào sau cùng
    Public TenUserControl As String

    'Hàm thêm user control lên  pnThuTien
    Public Sub ThemUserControl(uc As UserControl)
        If uc.Name <> TenUserControl Then
            TenUserControl = uc.Name
            pnThuTien.Controls.Clear()
            uc.Dock = DockStyle.Fill
            pnThuTien.Controls.Add(uc)
        End If
    End Sub

    Private Sub ThuTien_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim uc As New ucBangKeThuTien
        uc.Dock = DockStyle.Fill
        lbTieuDe.Text = "Bảng Kê Phiếu Thu Tiền"
        pnThuTien.Controls.Add(uc)
        TenUserControl = uc.Name
    End Sub

    Private Sub btnDanhSachPhieuCongNo_LinkClicked(sender As Object, e As DevExpress.XtraNavBar.NavBarLinkEventArgs) Handles btnDanhSachPhieuCongNo.LinkClicked
        Dim uc As New ucDanhSachCongNoChiTiet
        lbTieuDe.Text = "Danh Sách Công nợ Chi Tiết"
        ThemUserControl(uc)
    End Sub

    Private Sub btnDanhSachPhieuTraNgay_LinkClicked(sender As Object, e As DevExpress.XtraNavBar.NavBarLinkEventArgs) Handles btnDanhSachPhieuTraNgay.LinkClicked
        Dim uc As New ucBangKePhieuThanhToanNgay
        lbTieuDe.Text = "Bảng Kê Phiếu Thanh Toán Ngay"
        ThemUserControl(uc)
    End Sub

    Private Sub btnDanhSachPhieuThu_LinkClicked(sender As Object, e As DevExpress.XtraNavBar.NavBarLinkEventArgs) Handles btnDanhSachPhieuThu.LinkClicked
        Dim uc As New ucBangKeThuTien
        ThemUserControl(uc)
    End Sub
End Class
